using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class PayPal : System.Web.UI.Page
{
    SecurePay objSecurepay = new SecurePay();
    protected string Name = string.Empty;
    protected string Street = string.Empty;
    protected string City = string.Empty;
    protected string State = string.Empty;
    protected string Zip = string.Empty;
    protected string Email = string.Empty;
    protected string Amount = string.Empty;
    protected string CC_Number = string.Empty;
    protected string Month = string.Empty;
    protected string Year = string.Empty;
    protected string Merch_ID = string.Empty;
    protected string Success_URL = string.Empty;
    protected string Failure_URL = string.Empty;
    protected string Tr_Type = string.Empty;
    protected string Recurring = string.Empty;
    protected string TimeFrame = string.Empty;
    protected string Rec_Amount = string.Empty;
    protected string Start_Date = string.Empty;
    protected string CC_Method = string.Empty;
    protected string CC_Name = string.Empty;
    protected string TransactionKey = string.Empty;
    protected int AVSREQ = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        // determining the URL to work with depending on whether sandbox or a real PayPal account should be used
        objSecurepay = (SecurePay)Session["SetValue"];
        TransactionKey = ConfigurationManager.AppSettings["AuthNetTransKey"];
        Street = objSecurepay.Street;
        City = objSecurepay.City;
        State = objSecurepay.State;
        Zip = objSecurepay.Zip;
        Email = objSecurepay.Email;       
        Amount = objSecurepay.Amount;
        //Name = objSecurepay.CC_Name;
        Name = objSecurepay.Name;
        CC_Number = objSecurepay.CC_Number;
        CC_Method = "DataEntry";
        Month = objSecurepay.Month;
        Year = objSecurepay.Year.Substring(2,2);
        Merch_ID = ConfigurationManager.AppSettings["AuthNetLoginID"];
        TransactionKey = ConfigurationManager.AppSettings["AuthNetTransKey"];
        Success_URL = ConfigurationManager.AppSettings["strHttp"] + "doctor/status.aspx";
        Failure_URL = ConfigurationManager.AppSettings["strHttp"] + "doctor/status.aspx";
        Tr_Type = "SALE";
        if (objSecurepay.Recurring != null)
        {
            Recurring = objSecurepay.Recurring;
        }
        else
        {
            Recurring = "YES";
        }
        if (objSecurepay.TimeFrame == "Monthly")
        {
            TimeFrame = "Month";
        }
        else
        {
            TimeFrame = "Manual";
        }
        Rec_Amount = objSecurepay.Amount;
        Start_Date = DateTime.Now.ToString("dd/MM/yy");
        //Start_Date = DateTime.Now.ToShortDateString();
        AVSREQ = 0;
        form1.Attributes.Add("action", "https://www.securepay.com/secure14/index.cfm");

    }
}
